package com.appwoo.txtws.wheel.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.appwoo.txtws.activity.R.styleable;

public class TitleBar extends LinearLayout
{
  private View.OnClickListener barBackListener;
  private View.OnClickListener barHomeListener;
  private TextView barTitle;
  private View btnBarHome;
  private View btnBarback;
  private Button btnRight;
  private Drawable leftBackground;
  private ImageView leftBtn;
  private Drawable leftDrawable;
  private Drawable rightBackground;
  private ImageView rightBtn;
  private Drawable rightDrawable;
  private CharSequence rightText;
  private boolean showLeft;
  private boolean showRight;
  private CharSequence titleText;

  public TitleBar(Context paramContext)
  {
    this(paramContext, null);
  }

  public TitleBar(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
    LayoutInflater.from(paramContext).inflate(2130903152, this, true);
    init(paramContext, paramAttributeSet);
  }

  private void init(Context paramContext, AttributeSet paramAttributeSet)
  {
    TypedArray localTypedArray = paramContext.obtainStyledAttributes(paramAttributeSet, R.styleable.ActionBar);
    this.leftBackground = localTypedArray.getDrawable(0);
    this.leftDrawable = localTypedArray.getDrawable(1);
    this.rightBackground = localTypedArray.getDrawable(4);
    this.rightDrawable = localTypedArray.getDrawable(5);
    this.titleText = localTypedArray.getText(3);
    this.rightText = localTypedArray.getText(6);
    this.showLeft = localTypedArray.getBoolean(7, true);
    this.showRight = localTypedArray.getBoolean(8, true);
    localTypedArray.recycle();
  }

  private void initView()
  {
    this.leftBtn = ((ImageView)findViewById(2131493276));
    this.rightBtn = ((ImageView)findViewById(2131493280));
    this.barTitle = ((TextView)findViewById(2131493277));
    this.btnRight = ((Button)findViewById(2131493279));
    this.barTitle.setSelected(true);
    this.btnBarback = findViewById(2131493275);
    this.btnBarHome = findViewById(2131493278);
    if (!this.showLeft)
      this.btnBarback.setVisibility(4);
    if (!this.showRight)
      this.btnBarHome.setVisibility(4);
    if (this.leftBackground != null)
      this.leftBtn.setBackgroundDrawable(this.leftBackground);
    if (this.leftDrawable != null)
    {
      this.leftDrawable.setBounds(0, 0, this.leftDrawable.getIntrinsicWidth(), this.leftDrawable.getIntrinsicHeight());
      this.leftBtn.setImageDrawable(this.leftDrawable);
    }
    if (this.rightBackground != null)
      this.rightBtn.setBackgroundDrawable(this.rightBackground);
    if (this.rightDrawable != null)
    {
      this.rightDrawable.setBounds(0, 0, this.rightDrawable.getIntrinsicWidth(), this.rightDrawable.getIntrinsicHeight());
      this.rightBtn.setImageDrawable(this.rightDrawable);
    }
    if (this.titleText != null)
      this.barTitle.setText(this.titleText);
    if (this.barBackListener != null)
      this.leftBtn.setOnClickListener(this.barBackListener);
    if (this.barHomeListener != null)
      this.rightBtn.setOnClickListener(this.barHomeListener);
    if (this.barHomeListener != null)
      this.btnRight.setOnClickListener(this.barHomeListener);
  }

  protected void onFinishInflate()
  {
    initView();
    super.onFinishInflate();
  }

  public void setBarBackListener(View.OnClickListener paramOnClickListener)
  {
    this.barBackListener = paramOnClickListener;
  }

  public void setBarHomeListener(View.OnClickListener paramOnClickListener)
  {
    this.barHomeListener = paramOnClickListener;
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.wheel.widget.TitleBar
 * JD-Core Version:    0.6.2
 */